package com.daydaykeep.view;


import android.graphics.Color;
import android.provider.CalendarContract;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.facebook.react.uimanager.ReactCompoundView;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.views.image.ReactImageView;
import com.facebook.react.views.text.ReactTextView;
import com.facebook.react.views.view.ReactViewGroup;


public class ReactCalendarManage extends SimpleViewManager<CalendarView>
{

    public static final String CalendarViewName="CalendarView";
    public ReactViewGroup view;
    public CalendarView calendar_view;
    public ThemedReactContext context;
    public String calendar_tag="calendar_view";

    @Override
    public String getName() {
        return CalendarViewName;
    }

    @Override
    protected CalendarView createViewInstance(ThemedReactContext reactContext) {
        view = new ReactViewGroup(reactContext);
        view.setBackgroundColor(Color.YELLOW);
        view.setMinimumWidth(1000);
        view.setX(0.0f);
        view.setY(0.0f);
        AbsoluteLayout.LayoutParams layoutParams=new AbsoluteLayout.LayoutParams(0,0,1000,1000);
        view.setLayoutParams(layoutParams);
        view.setEnabled(true);
        ViewGroup.LayoutParams params=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        view.setLayoutParams(params);
        calendar_view = new CalendarView(reactContext);
        calendar_view.setTag(calendar_tag);
        //view.addView(calendar_view);
        return calendar_view;
    }

    @ReactProp(name="text")
    public void setText(ReactViewGroup view,@Nullable String text)
    {
        CalendarView ca_view=(CalendarView)view.findViewWithTag(calendar_tag);
        ca_view.setBackgroundColor(Color.WHITE);
    }
}